/*
 * @Author: yangzonglong
 * @Date: 2020-06-23 10:54:11
 * @version: v1.0.0
 * @Descripttion: 
 * @LastEditors: yangzonglong
 * @LastEditTime: 2021-03-16 13:42:40
 * @Auditor: 
 */
import { ColumnProps, ExtraItemProps } from './../table/interface';
import { FormItemProps, Extra } from './../formx/interface';
import { ColProps } from 'antd/lib/grid/col';
export interface TableExtraRenderExtra {
  remove(record: any): void;
  showEdit(record: any): void
}
export interface EditProps {
  visible: boolean;
  formItems: FormItemProps[];
  onCancel(): void;
  initialValues: any;
  labelCol?: ColProps;
  wrapperCol?: ColProps;
  layout?: 'horizontal' | 'inline' | 'vertical';
  onOk(values: any): void;
  groupNumber?: number;
  disabled?: boolean;
  loading?: boolean;
  onRemove?(values: any): void;
  onValuesChange?(changedValues: any, allValues: any): void;
  formExtra?: Extra
}

export interface CRUDProps {
  baseUrl?: string;
  columns: ColumnProps<object>[];
  formItems: FormItemProps[];
  urls?: {
    findUrl?: string;
    removeUrl?: string;
    updateUrl?: string;
    addUrl?: string;
  },
  onValuesChange?(changedValues: any, allValues: any): void;
  saveDataBefore?(data: any): any | string;
  saveDataAfter?(data: any, result: any): void;
  getDataAfter?(data: any): any;
  deleteDataAfter?(data: any): any;
  showCreateModalBefore?(data?: any, list?: any[]): void;
  placeholder?: string;
  searchFields?: string[];
  formExtra?: Extra;
  tableExtra?: ExtraItemProps<any>[]
}

export interface CRUDRefProps {
  onRefresh(): void
}